#include<iostream>
using namespace std;
# define jghour 40
# define jgyear 5
int main(){
	int pyear;
	int phour;
	cin>>pyear>>phour;
	int yflg=30;
	if(pyear>=jgyear){
		yflg=50;
	}
	float tsalary=0;
	if(phour>=jghour){
		tsalary=(phour-jghour)*yflg*1.5;
		phour=jghour;
	}
	float salary;
	salary=phour*yflg+tsalary;
	printf("%.2f",salary);
	
	return 0;
}
